#ifndef FORMCONFIGURATION_H
#define FORMCONFIGURATION_H

#include <QWidget>
#include <QStringList>
#include <QStringListModel>
#include <QDebug>
#include "listeusers.h"
#include "listetypeprestation.h"
#include "databasemanager.h"
#include "laddatabasemanager.h"


namespace Ui {
class FormConfiguration;
}

class FormConfiguration : public QWidget
{
    Q_OBJECT
    
public:
    explicit FormConfiguration(databaseManager &datab, QStringList &listeTypeClient,QStringList &listeSono, ListeUsers &listeUser, ListeTypePrestation &listeTypePrestation, QWidget *parent = 0);
    ~FormConfiguration();

    static const QString Ajouter;
    static const QString Nouveau;

private slots:
    void AjouterTypeSono();
    void AjouterTypeClient();
    void AjouterTypePrestation();
    void AjouterUser();

    void SupprimerTypeSono();
    void SupprimerTypeClient();
    void SupprimerTypePrestation();
    void SupprimerUser();

    void SelectTypePrestation(QModelIndex index);
    void SelectUser(QModelIndex index);

    void ModifierUser();
    void ModifierTypePrestation();

    void ResetLineEditStyleSheet(QString text);

private:
    Ui::FormConfiguration *ui;

    QStringList *m_listeTypeSono;
    QStringList *m_listeTypeClient;
    ListeUsers *m_listeUsers;
    int currentUser;
    int currentTypePrestation;

    ListeTypePrestation *m_listeTypePrestation;

    databaseManager *db;
    ladDatabaseManager ladDb;

    QStringListModel *m_listeTypeSonoModel;
    QStringListModel *m_listeTypeClientModel;
    QStringListModel *m_listeTypePrestationModel;
    QStringListModel *m_listeUserModel;

    QAction *actionSupprimerTypeClient;
    QAction *actionSupprimerTypeSono;
    QAction *actionSupprimerTypePrestation;
    QAction *actionSupprimerUser;

    void ClearUserFields();
    void ClearTypePrestationFields();
    TypePrestation CreateTypePrestation(TypePrestation t);
    User CreateUser(User u);

    void Affichage();

};

#endif // FORMCONFIGURATION_H
